# Searches for QHULL includes and library files
#
# Sets the variables
#   QHULL_FOUND
#   QHULL_INCLUDE_DIR
#   QHULL_LIBRARIES

SET (QHULL_FOUND FALSE)

FIND_PATH (QHULL_INCLUDE_DIR libqhull_r/qhull_ra.h
	/usr/include
	/usr/local/include
	$ENV{HOME}/local/include
	$ENV{QHULL_PATH}/src
	$ENV{QHULL_PATH}/include
	$ENV{QHULL_INCLUDE_PATH}
	)
FIND_LIBRARY (QHULL_LIBRARY NAMES qhull_r	PATHS
	/usr/lib
	/usr/local/lib
	$ENV{HOME}/local/lib
	$ENV{QHULL_PATH}
	$ENV{QHULL_LIBRARY_PATH}
	)


IF (QHULL_INCLUDE_DIR AND QHULL_LIBRARY)
	SET (QHULL_FOUND TRUE)
ENDIF (QHULL_INCLUDE_DIR AND QHULL_LIBRARY)

SET(QHULL_LIBRARIES ${QHULL_LIBRARY})

IF (QHULL_FOUND)
   IF (NOT QHULL_FIND_QUIETLY)
      MESSAGE(STATUS "Found QHULL: ${QHULL_LIBRARY}")
   ENDIF (NOT QHULL_FIND_QUIETLY)
ELSE (QHULL_FOUND)
   IF (QHULL_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "Could not find QHULL")
   ENDIF (QHULL_FIND_REQUIRED)
ENDIF (QHULL_FOUND)

MARK_AS_ADVANCED (
	QHULL_INCLUDE_DIR
	QHULL_LIBRARIES
	QHULL_LIBRARY	
	)
